#pragma once

struct ComException
{
	HRESULT result;

	ComException(HRESULT const value) :
		result(value)
	{
	}
};

static void HR(HRESULT const result)
{
	if (S_OK != result)
	{
		throw ComException{ result };
	}
}

template <typename T>
float PhysicalToLogical(T const pixel,
	float const dpi)
{
	return pixel * 96.0f / dpi;
}

template <typename T>
float LogicalToPhysical(T const pixel,
	float const dpi)
{
	return pixel * dpi / 96.0f;
}